﻿using MySchool;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace RecordManager
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }

        private void Form3_Load(object sender, EventArgs e)
        {
            try
            {
                // 初始化数据
                DBHelper dBHelper = new DBHelper();
                DataSet ds = new DataSet();

                dBHelper.OpenConnection();

                string sql = "select * from Record";

                SqlDataAdapter adapter = new SqlDataAdapter(sql, dBHelper.Connection);

                adapter.Fill(ds, "Record");

                this.dataGridView1.DataSource = ds.Tables["Record"];

                dBHelper.CloseConnection();
            }
            catch (Exception) {
                throw;
            }
            finally
            {

            }
        }
    }
}
